import request from "../request";

/**
 * 删除登录日志
 * @param {* 编号集合} ids 
 * @returns json格式数据
 */
export const deleteLoginLog = async (ids) => {
    return request.delete('/api/loginLog/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: ids
    })
}

/**
 * 查询登录日志列表
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const getLoginLogList = async (params) => {
    return request.get(`/api/loginLog/find`, {
        params: params
    })
}
/**
 * 添加登录日志信息
 * @param {* 登录日志数据} loginLogData 
 * @returns json格式数据
 */
export const insertLoginLog = async (loginLogData) => {
    return request.post('/api/loginLog/insert', loginLogData, {
        headers: { 'Content-Type': 'application/json' }
    })
}


// /**
//  * 查询销售出库
//  * @param {* 查询参数} params 
//  * @returns 
//  */
// export const getSalesList = async (params) => {
//     return request.get('/api/salesOutbound/find', {
//         params: params
//     })
// }

// export const deletesalesOutbound = async (ids) => {
//     return request.delete('/api/salesOutbound/delete', {
//         headers: { 'Content-Type': 'application/json' },
//         data: ids
//     })
// }
// export const insertsalesOutbound = async (sales)=>{
//     return request.post('/api/salesOutbound/insert',sales,{
//         headers: { 'Content-Type': 'application/json' }
//     })
// }


// /**
//  * 查询销售出库记录表
//  * @param {* 查询参数} params 
//  * @returns 
//  */
// export const getWmRtSalseLine= async (params) => {
//     return request.get('/api/WmRtSalseLine/find', {
//         params: params
//     })
// }
// export const insertWmRtSalseLine= async (sales)=>{
//     return request.post('/api/WmRtSalseLine/insert',sales,{
//         headers: { 'Content-Type': 'application/json' }
//     })
// }

/**
 * 查询SN表
 * @param {*} params 
 * @returns 
 */
export const getSnTbaleList = async (params) => {
    return request.get('/api/SnCode/find', {
        params: params
    })
}
export const deleteSnTbale = async (ids) => {
    return request.delete('/api/SnCode/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: ids
    })
}

export const insertsn = async (snData)=>{
    return request.post('/api/SnCode/insert',snData,{
        headers: { 'Content-Type': 'application/json' }
    })
}


/**
 * 删除设备类型设置
 * @param {* 编号集合} deviceTypeNo 
 * @returns json格式数据
 */
export const deleteReversoContexts = async (projectNo) => {
    return request.delete('/api/reversoContexts/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: projectNo
    })
}

/**
 * 查询设备类型设置
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const getReversoContextsfind = async (params) => {
    return request.get(`/api/reversoContexts/find`, {
        params: params
    })
}
//新增
export const insertReversoContexts = async (projectNo) => {
    return request.post('/api/reversoContexts/insert', projectNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}
//修改
export const updateReversoContexts = async (projectNo) => {
    return request.put('/api/reversoContexts/update', projectNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}




/**
 * 删除点检保养项目
 * @param {* 编号集合} deviceTypeNo 
 * @returns json格式数据
 */
export const deletespotInspection = async (planNo) => {
    return request.delete('/api/spotInspection/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: planNo
    })
}

/**
 * 查询设备类型设置
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const getspotInspectionfind = async (params) => {
    return request.get(`/api/spotInspection/find`, {
        params: params
    })
}
//新增
export const insertspotInspection = async (planNo) => {
    return request.post('/api/spotInspection/insert', planNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}
//修改
export const updatespotInspection = async (planNo) => {
    return request.put('/api/spotInspection/update', planNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}






/**
 * 删除点检保养计划
 * @param {* 编号集合} deviceTypeNo 
 * @returns json格式数据
 */
export const deletetpmPlan = async (deviceTypeNo) => {
    return request.delete('/api/tpmPlan/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: deviceTypeNo
    })
}

/**
 * 查询点检保养计划
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const gettpmPlanfind = async (params) => {
    return request.get(`/api/tpmPlan/find`, {
        params: params
    })
}
//新增点检保养计划
export const inserttpmPlan = async (deviceTypeNo) => {
    return request.post('/api/tpmPlan/insert', deviceTypeNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}
//修改点检保养计划
export const updatestpmPlan = async (deviceTypeNo) => {
    return request.put('/api/tpmPlan/update', deviceTypeNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}



/**
 * 查询设备台账
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const getDeviceLedgerfind = async (params) => {
    return request.get(`/api/deviceLedger/find`, {
        params: params
    })
}


/**
 * 查询维修
 */
export const findwx = async (params) => {
    return request.get(`/api/repairOrders/find`,{
        params: params
    })
}









// /**
//  * 删除销售订单
//  * @param {* 编号集合} deviceTypeNo 
//  * @returns json格式数据
//  */
// export const deletesalesOrders = async (projectNo) => {
//     return request.delete('/api/salesOrders/delete', {
//         headers: { 'Content-Type': 'application/json' },
//         data: projectNo
//     })
// }

// /**
//  * 查询销售订单
//  * @param {* 查询参数} params 
//  * @returns json格式数据
//  */
// export const findorders = async (params) => {
//     return request.get(`/api/salesOrders/find`, {
//         params: params
//     })
// }


// //修改销售订单
// export const updatesalesOrders = async (soId) => {
//     return request.put('/api/salesOrders/update', soId, {
//         headers: { 'Content-Type': 'application/json' }
//     })
// }
// //新增销售订单
// export const insertsalesOrders = async (dataToSubmit) => {
//     return request.post('/api/salesOrders/insert', dataToSubmit, {
//         headers: { 'Content-Type': 'application/json' }
//     })
// }
// //新增销售订单产品列信息
// export const insertsalesLIst = async (dataToSubmit) => {
//     return request.post('/api/salesLists/insert', dataToSubmit, {
//         headers: { 'Content-Type': 'application/json' }
//     })
// }

/**
 * 查询生产领料
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const findproductionPicking = async (params) => {
    return request.get(`/api/productionPicking/find`, {
        params: params
    });
}

//新增生产领料行表
export const insertWmIssueLine = async (dataToSubmit) => {
    return request.post('/api/WmIssueLine/insert', dataToSubmit, {
        headers: { 'Content-Type': 'application/json' }
    })
 }
 //查询生产领料行表
 export const findWmIssueLine = async (params) => {
    return await request.get(`/api/WmIssueLine/find`, {
        params: params // 传入一个包含 ID 的对象
    });
        
}
//修改生产领料行表
export const updatWmIssueLine = async (lineId) => {
    console.log(lineId);
    
   return request.put(`/api/WmIssueLine/update`, lineId,{
       headers: { 'Content-Type': 'application/json' }
   });
};
//修改生产领料库存数量
export const updatWmIssueLineShuangliang = async (lineId) => {
    console.log(lineId);    
   return request.put(`/api/WmIssueLine/updateShuliang`, lineId,{
       headers: { 'Content-Type': 'application/json' }
   });
};

//删除生产领料行表
export const deleteWmIssueLine = async (lineId) => {
    return request.delete('/api/WmIssueLine/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: lineId
    })
}


//修改生产领料状态
export const updatproductionPickingzt = async (id) => {
   return request.put(`/api/updatproductionPickingzt/update`, id,{
       headers: { 'Content-Type': 'application/json' }
   });
};


//删除生产领料
export const deletePicking = async (lineId) => {
   return request.delete('/api/productionPicking/delete', {
       headers: { 'Content-Type': 'application/json' },
       data: lineId
   })
}
//修改生产领料
export const updatePicking = async (data) => {
    console.log("打印数据",data);
   return request.put('/api/productionPicking/update', data, {
       headers: {'Content-Type': 'application/json' }
   })
}

//新增生产领料
export const insertPicking = async (dataToSubmit) => {
   return request.post('/api/productionPicking/insert', dataToSubmit, {
       headers: { 'Content-Type': 'application/json' }
   })
}
/**
 * 查询设备台账
 * @param {* 查询参数} params 
 * @returns json格式数据
 */
export const finddeviceLedger = async (params) => {
    return request.get(`/api/deviceLedger/find`, {
        params: params
    })
}
/**
 * 删除设备台账
 * @param {* 编号集合} deviceTypeNo 
 * @returns json格式数据
 */
export const deletedeviceLedger = async (deviceNo) => {
    return request.delete('/api/deviceLedger/delete', {
        headers: { 'Content-Type': 'application/json' },
        data: deviceNo
    })
}
//修改设备台账
export const updatedeviceLedger = async (deviceNo) => {
    return request.put('/api/deviceLedger/update', deviceNo, {
        headers: { 'Content-Type': 'application/json' }
    })
}

//新增设备台账
export const insertdeviceLedger = async (dataToSubmit) => {
    return request.post('/api/deviceLedger/insert', dataToSubmit, {
        headers: { 'Content-Type': 'application/json' }
    })
}

